package archer.framework.utils;

import jodd.jerry.Jerry;
import jodd.lagarto.dom.LagartoDOMBuilder;

/**
 * Jerry工具类
 *
 * @author christ
 * @date 2016/3/2
 */
public class JerryUtils {

    /**
     * xml模式解析
     *
     * @param content
     * @return
     */
    public static Jerry xmlJerry(String content) {
        LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
        domBuilder.enableXmlMode();
        return Jerry.jerry(domBuilder).parse(content);
    }

    /**
     * html模式解析
     *
     * @param content
     * @return
     */
    public static Jerry htmlJerry(String content) {
        LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
        domBuilder.enableHtmlMode();
        return Jerry.jerry(domBuilder).parse(content);
    }

    /**
     * xhtml模式解析
     *
     * @param content
     * @return
     */
    public static Jerry xhtmlJerry(String content) {
        LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
        domBuilder.enableXhtmlMode();
        return Jerry.jerry(domBuilder).parse(content);
    }


    /**
     * html-plus模式解析
     *
     * @param content
     * @return
     */
    public static Jerry htmlPlusJerry(String content) {
        LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
        domBuilder.enableHtmlPlusMode();
        return Jerry.jerry(domBuilder).parse(content);
    }
}
